import Vue from 'vue'

const component = {
  // 自定义双向绑定 名称 事件
  model: {
    prop: 'value1',
    event: 'change'
  },
  props: ['value1'],
  template: `
    <input type="text" @input="handelInput" :value="value1">
  `,
  data () {
    return {
    }
  },
  mounted () {
  },
  methods: {
    handelInput (e) {
      this.$emit('change', e.target.value)
    }
  }
}

new Vue({
  el: '#app',
  components: {
    CompOne: component
  },
  mounted () {
  },
  data: {
    value: 23333
  },
  // <comp-one :value="value" @input="value = arguments[0]"></comp-one>
  template: `
    <div>
      <comp-one v-model="value"></comp-one>
      <span>{{value}}</span>
    </div>
  `
})
